using Dictionary = Godot.Collections.Dictionary;
public class ToolData : ItemData
{
    public Tool tool;
    public int Durable;
    public int Max;
    public ToolData(Tool tool, int Durable)
    {
        this.tool = tool;
        this.Durable = Durable;
        this.Max = Durable;
    }
    public bool IsMax()
    {
        return Durable >= Max;
    }
    public bool SubDurable(int i)
    {
        Durable -= i;
        if (Durable <= 0)
        {
            return false;
        }
        else
        {
            return true;
        }
    }
    public override Dictionary GetDictionary()
    {
        Dictionary dict = new Dictionary();
        dict.Add("tool", tool.GetDictionary());
        dict.Add("Durable", Durable);
        dict.Add("Max", Max);
        return dict;
    }
    public override ItemData Parse(Dictionary dictionary)
    {
        this.tool = new Tool().Parse((Dictionary)dictionary["tool"]);
        this.Durable = dictionary["Durable"].ToInt();
        this.Max = dictionary["Max"].ToInt();
        return this;
    }
    public override Store GetStore() { return null; }

    public override ItemData Copy()
    {
        ToolData td = new ToolData(new Tool(tool.type, tool.level, tool.punish, tool.drop), Max);
        td.Durable = this.Durable;
        return td;
    }
}